<?php
/**
 *      [迷你云] (C)2009-2012 南京恒为网络科技.
 *   软件仅供研究与学习使用，如需商用，请访问www.miniyun.cn获得授权
 * 
 */
?>
<?php

class AdminControlPanelController extends CAdminController
{
	public $layout='//layouts/admin';

	public function actionIndex()
	{
		$baseInfoForm     = new BaseInfoForm();
		$fileModel        = new UserFile();
		$fileVersionModel = new FileVersion();
		$userModel        = new User();
		$onlineDevice     = new OnlineDevice();
		$this->render('baseInfo',array(
            'model'              => $baseInfoForm,
		    'fileModel'          => $fileModel,
            'fileVersionModel'   => $fileVersionModel,
            'userModel'          => $userModel,
		    'onlineDevice'       => $onlineDevice,
		));

	}
	public function actionUpdate()
	{
		$this->render('update');
	}
    
	public function actionOnline() {
	    $model              = new OnlineListForm();
	    if(Yii::app()->request->isPostRequest){
			$model->attributes=@$_POST['OnlineListForm'];
	    }
	    $onlineDevice       = new OnlineDevice();
	    $this->render("online", array(
	        'model'          => $model,
	        'count'          => $onlineDevice->count("(now()- updated_at)<=300"),
	    ));
	}
}